#ifndef PRINT_H
#define PRINT_H

#include<stdio.h>

#define INFO     (0)
#define WARN     (1)
#define WARN_DBG (2)
#define DEBUG    (3)
#define ERR      (4)
#define ERR_DBG  (5)
#define SUCCESS  (0)
#define FAILURE  (1)
#define level_print(lvl, fmt, ...)                                                                          \
    do                                                                                                      \
    {                                                                                                       \
        switch (lvl)                                                                                        \
        {                                                                                                   \
        case INFO:                                                                                          \
            fprintf(stdout, fmt "\n", ##__VA_ARGS__);                                                  \
            break;                                                                                          \
        case WARN:                                                                                          \
            fprintf(stdout, "[WARNING]: " fmt "\n", ##__VA_ARGS__);                                         \
            break;                                                                                          \
        case WARN_DBG:                                                                                      \
            fprintf(stdout, "[WARNING]:%s : %04d: " fmt "\n", __func__, __LINE__, ##__VA_ARGS__); \
            break;                                                                                          \
        case DEBUG:                                                                                         \
            fprintf(stdout, "%s:  %04d: " fmt "\n", __func__, __LINE__, ##__VA_ARGS__);            \
            break;                                                                                          \
        case ERR:                                                                                           \
            fprintf(stderr, "[ERROR]:" fmt "\n", ##__VA_ARGS__);                                            \
            break;                                                                                          \
        case ERR_DBG:                                                                                       \
            fprintf(stderr, "[ERROR]: %s: %04d: " fmt "\n", __func__, __LINE__, ##__VA_ARGS__);   \
            break;                                                                                          \
        default:                                                                                            \
            fprintf(stdout, "[WARNING]!!! print Level is not match\n");                                     \
            break;                                                                                          \
        }                                                                                                   \
    } while (0)
#endif
